/*
 * Copyright (C) 2012 mAPPn.Inc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.mol.market.common.network;

import java.io.InputStream;

/**
 * API请求结果。
 * <p/>
 * Author: Andrew.Wang
 * Date  : 12-9-25
 * Since : Version 0.9.6
 */
public class ApiResponse {

    /**
     * 业务逻辑异常
     */
    public static final int STATUS_LOGIC_ERROR = 0xff00;

    /**
     * 网络链接超时异常
     */
    public static final int STATUS_TIMEOUT_ERROR = 0xff01;

    /**
     * 请求正常
     */
    public static final int STATUS_OK = 200;

    /**
     * API response content
     */
    InputStream content;

    /**
     * Api request code
     */
    public int action;

    /**
     * API响应码
     */
    public int status;

    /**
     * Charset
     */
    public String charset;

    /**
     * Api result
     */

    public Object result;


    public ApiResponse(int actionCode, int statusCode) {
        action = actionCode;
        status = statusCode;
    }

    public enum ValueType {
        TYPE_INT,
        TYPE_TEXT,
        TYPE_LIST,
        TYPE_MAP,
        TYPE_OBJ,
    }
}
